package com.huatai.bi.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huatai.bi.entity.BigScreenDataSetEntity;
import com.huatai.bi.service.BigScreenDataSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @BelongsProject: huatai-airport-cloud
 * @BelongsPackage: com.huatai.bi.service.impl
 * @Author: hecaiy
 * @CreateTime: 2024-08-12  15:14
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class DataSetCommonService {

    @Autowired
    private BigScreenDataSetService bigScreenDataSetService;


    /**
     * 判断数据集是否被使用
     */
    public Boolean isUseDataSetById(Long id){
        if(ObjectUtil.isEmpty(id)){
            return false;
        }
        long count = bigScreenDataSetService.count(Wrappers.<BigScreenDataSetEntity>lambdaQuery().like(BigScreenDataSetEntity::getDtIds, id));
        if(count>0){
            return true;
        }
        return false;
    }
}
